<?php


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table align="center" width="1000" cellpadding="0" cellspacing="1" style="border:1px solid #CCC">
  <tr bgcolor="#EEE" height="24">
    <td>接口地址</td>
    <td>method</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td><select id="api_host">
<?php
	foreach($hosts as $host){
?>
      <option value="<?php echo $host?>"><?php echo $host?></option>
<?php
	}
?>
    </select><?php echo $url?></td>
    <td><?php echo $method?></td>
  </tr>
</table>
<br>
<table align="center" width="1000" cellpadding="0" cellspacing="1" style="border:1px solid #CCC">
  <form id="requestform" method="<?php echo $method?>">
  <tr bgcolor="#EEE" height="24">
    <td>参数名</td>
    <td>参数</td>
    <td>必填</td>
    <td>类型</td>
    <td>说明</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>Authorization</td>
    <td><input name="Authorization" type="text" value=""/></td>
    <td>是</td>
    <td>string</td>
    <td>token</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>page</td>
    <td><input name="page" type="text" value="1"/></td>
    <td>否</td>
    <td>string</td>
    <td>当前页</td>
  </tr>

  <tr bgcolor="#F9F9F9" height="24">
    <td>limit</td>
    <td><input name="limit" type="text" value="10"/></td>
    <td>否</td>
    <td>string</td>
    <td>分页大小，默认值10</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td>last_id</td>
    <td><input name="last_id" type="text" value=""/></td>
    <td>否</td>
    <td>string</td>
    <td>分页片段末尾id</td>
  </tr>
  <tr bgcolor="#F9F9F9" height="24">
    <td colspan="5" align="center"><input type="button" value="提交" onclick="request()"/></td>
  </tr>
  </form>
</table>
<script language="javascript">

function request(){
	
	var isAuth = <?php echo $isAuth ? 'true' : 'false'?>;
	
	var requestform = document.getElementById("requestform");
	var api_host = document.getElementById("api_host");
	
	requestform.action = isAuth ? "/info/asyncIndex" : api_host.value+"<?php echo $url?>";
	
	requestform.submit();
}


</script>
</body>
</html>